<?php
include_once 'constants.php';
logIt("index.php msg:",'1');
session_start();
$msg = isset($_SESSION[$sessionIndexMsgTag])?$_SESSION[$sessionIndexMsgTag]:null;
if($msg)unset($_SESSION[$sessionIndexMsgTag]);
$loggedIn = isset($_SESSION[$sessionLoginTag])?$_SESSION[$sessionLoginTag]:null;
?>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1"> 
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.1/jquery.mobile-1.2.1.min.css" />
<link rel="stylesheet" href='style/my.css'/>
<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.1/jquery.mobile-1.2.1.min.js"></script>
<script src='js/my.js'></script>
</head>
<body>
<div data-role="page" id='index'>
	<div data-role="header" data-position="fixed">
		<div data-role="navbar">
			<ul>
				<?php 
					if(!$loggedIn){
						echo'<li><a href="#login" data-role="button">Login</a></li>';
						echo'<li><a href="#register" data-role="button">Register</a></li>';
					}else{
						echo'<li><a href="findMyLoc.php" data-ajax="false" data-role="button">Where Am I?</a></li>';
						echo'<li><a href="logout.php" data-ajax="false" data-role="button">Logout</a></li>';
					}
				?>
				<li><a href="#track" data-role="button">Track</a></li>
			</ul>
		</div>

	</div>
	<div data-role="content">
		<div id='data'></div>
	</div>
</div>

<div data-role="page" data-theme="a" id="register"> 
	<?php echo $exitNavBar;?>
   	<div data-role="content"> 
       	<p id='registerHdr'>Register</p>
     	<input type='text' id='registerEmail' placeholder='me@gmail.com'/>
     	<input type='text' id='registerPhone' placeholder='512xxx9999'/>
     	<input type='text' id='registerAlias' placeholder='badBoy'/>
        <button data-theme="e" name="registerButton" id="registerButton" onclick='register();'>Register</button>
    </div>
</div>

<div data-role="page" data-theme="a" id="login"> 
	<?php echo $exitNavBar;?>
   	<div data-role="content"> 
       	<p id='loginHdr'>Login</p>
       	<input type='text' id='unit' placeholder='unit'/>
     	<input type='text' id='email' placeholder='me@gmail.com'/>
     	<input type='text' id='phone' placeholder='512xxx9999'/>
     	<input type='text' id='alias' placeholder='badBoy'/>
        <button data-theme="e" name="loginButton" id="loginButton" onclick='login();'>Login</button>
    </div>
</div>

<div data-role="page" data-theme="a" id="track"> 
   	<div data-role="content"> 
       	<div id='trackHdr'>Enter Alias</div>
     	<input type='text' id='trackAlias' placeholder='Alias'/>
        <button data-theme="e" name="trackButton" id="trackButton" onclick='track();'>Track</button>
    </div>
</div>

</body>
</html>